
#include "Util.h"


const char* util::intToCharString(int value) {

	std::string s;
	std::stringstream out;
	out << value;
	s = out.str();
	return s.c_str();
}

char* util::floatToCharString(float value) {
	char* sString = "";
	sprintf(sString, "%f", value);
	return(sString);
}

char* util::boolToCharString(bool value) {
	if (value) return "true";
	else return "false";
}

std::string util::intToString(int value){

	std::string s;
	std::stringstream out;
	out << value;
	s = out.str();
	return s;
}

std::string util::floatToString(float value){

	std::string s;
	std::stringstream out;
	out << value;
	s = out.str();
	return s;
}

std::string util::boolToString(bool value){

	std::string s;
	std::stringstream out;
	if (value) out << "true";
	else out << "false";
	s = out.str();
	return s;
}

std::string util::longToString(int long value){
	std::string s;
	std::stringstream out;
	out << value;
	s = out.str();
	return s;
}

bool util::compare(const Type& i,const Type& j) {
	switch (i.type){
	case INT:
		return (i.intVal < j.intVal);
	case FLOAT:
		return (i.floatVal < j.floatVal);
	}
}

